<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCruiseCheckAlbumTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cruise_check_album', function (Blueprint $table) {
            $table->id();
            $table->unsignedTinyInteger('type')->default(0)->comment('文件类型 0-图片 1-视频');
            $table->string('url', 225)->default('')->comment('资源地址');
            $table->unsignedInteger('relationId')->default(0)->comment('关联ID');
            $table->unsignedTinyInteger('isPublic')->default(1)->comment('是否共有资源 0-私有的  1-共有的');
            $table->unsignedTinyInteger('module')->default(1)->comment('模块 3-门店稽核  5-工厂稽核');
            $table->unsignedTinyInteger('status')->default(0)->comment('状态 0-未使用  1-已使用 2-已过期');
            $table->unsignedInteger('isDeleted')->default(0)->comment('是否删除 0 - 正常 1 - 已删除');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->index('relationId', 'idx_relationId');
            $table->index('status', 'idx_status');
            $table->comment = '稽核相册';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cruise_check_album');
    }
}
